package com.hoo.mapper.account;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.hoo.entity.account.Resource;

public interface ResourceMapper extends SqlMapper {
  /**
   * 获取角色所有菜单列表
   * 
   * @param roleId
   * @return
   */
  @Select("select * from resources where id in (select resource_id from rel_role_resources where role_id = #{roleId})")
  List<Resource> getResourcesByRoleId(Integer roleId);
  
  /**
   * 获取角色对应的模块名
   * 
   * @param roleId
   * @return
   */
  List<Resource> getModulesByRoleId(Integer roleId);

  /**
   * 获取角色对应的菜单
   * 
   * @param roleId
   * @param moduleId
   * @return
   */
  public List<Resource> getMenusByParenIdAndRoleId(@Param("parentId") Integer parentId,
      @Param("roleId") Integer roleId);
}
